package day01;

import java.io.FileWriter;
import java.io.PrintWriter;

public class App {
	public static void main(String[] args) throws Exception {

		// Scanner sca = new Scanner(System.in);
		// String name = sca.next();
		// int age = sca.nextInt();
		// int money = sca.nextInt();
		for (int i = 100; i < 110; i++) {
		//	for (int j = 500; j < 550; j++) {
				User user = new User("Wangpeihu", i, 200);
				try {
					FileWriter writer = new FileWriter("../../user.xml", true);
					PrintWriter out = new PrintWriter(writer);
					StringBuffer sb = new StringBuffer();
					sb.append("<?xml version=\"1.0\" ?>\n");
					sb.append("<users>\n");
					sb.append("    <user>\n");
					sb.append("        <name>" + user.getName() + "</name>\n");
					sb.append("        <age>" + user.getAge() + "</age>\n");
					sb.append("        <money>" + user.getMoney()
							+ "</money>\n");
					sb.append("    </user>\n");
					sb.append("</users>\n");
					out.print(sb.toString());

					out.close();
					writer.close();
				} catch (Exception e) {
					e.printStackTrace();
				}

//			}
		}
	}
}
